package com.travel.controller.admin;

import com.travel.pojo.dto.OrderDTO;
import com.travel.pojo.dto.OrderQueryDTO;
import com.travel.pojo.dto.PageDTO;
import com.travel.pojo.vo.OrderVO;
import com.travel.service.IOrderService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@RestController("adminOrderController")
@Slf4j
@RequestMapping("/admin/order")
public class OrderController {
    private final IOrderService orderService;

    @PostMapping("/list")
    public PageDTO<OrderVO> pageOrder(@RequestBody OrderQueryDTO orderQueryDTO){
        return orderService.pageOrder(orderQueryDTO);
    }

    @PutMapping("/updateOrder/{id}")
    public void updateOrder(@PathVariable Long id, @RequestBody OrderDTO orderDTO){
        orderService.updateOrder(id, orderDTO);
    }

    @DeleteMapping("/deleteOrder/{id}")
    public void deleteOrder(@PathVariable Long id){
        orderService.removeById(id);
    }

    @PostMapping("/createOrder")
    public void createOrder(@RequestBody OrderDTO orderDTO){

    }

}
